package com.book.service.decorator;

import com.book.pojo.Order;
import com.book.service.inter.OrderServiceInterface;

/**
 * @param
 * @author oyz
 * @version 1.0.4
 * @description: 装饰器抽象类,用来在原有接口的基础上扩展新地更新用户积分的方法
 * @date 2024/4/25 21:47
 */
public abstract class AbstractOrderServiceDecorator implements OrderServiceInterface {

    private OrderServiceInterface orderService;

    @Override
    public Order createOrder(String productId) {
        return orderService.createOrder(productId);
    }

    @Override
    public Order payOrder(String orderId) {
        return orderService.payOrder(orderId);
    }

    @Override
    public String getPayUrl(String productId, Float price, Integer payType) {
        return orderService.getPayUrl(productId, price, payType);
    }

    public void setOrderService(OrderServiceInterface orderService) {
        this.orderService = orderService;
    }

    /**
     * 更新用户积分
     * @param orderId
     * @param serviceLvl
     * @param price
     */
    protected abstract void updateScoreAndSendRedPapers(String orderId,int serviceLvl,float price);

}
